

<div id="user_save">
    <form>
        <zrow>

            <zcol :md="6">
                <zinput label="name" name="name" :ctx="this"/>
            </zcol>

            <zcol :md="6">
                <zinput label="telephone" name="telephone" :ctx="this"/>
            </zcol>
        </zrow>


        <zrow>
            <zcol :md="6">
                <zinput label="email" name="email" :ctx="this"/>
            </zcol>

            <zcol :md="6">
                <zinput label="password" name="password" :ctx="this"/>
            </zcol>
        </zrow>


        <zrow>
            <zcol :md="6">
                <zinput label="remember_token" name="remember_token" :ctx="this"/>
            </zcol>

            <zcol :md="6">
                <zinput label="created_at" name="created_at" :ctx="this"/>
            </zcol>
        </zrow>


        <zrow>
            <zcol :md="6">
                <zinput label="updated_at" name="updated_at" :ctx="this"/>
            </zcol>
        </zrow>

        <a @click="submit" class="btn btn-primary">提交</a>
    </form>

</div>

<script>
    new Vue({
        el:'#user_save',
        mounted:function(){
            if(this.editData){
                this.form = this.editData ;
            }
            this.state.status = 'mounted'
        },
        data:{
            state:{
                status:''
            },
            form:{
                name:'',
                telephone:'',
                email:'',
                password:'',
                remember_token:'',
                created_at:'',
                updated_at:'',
            },
            validate:{
                name:[Va.required],
                telephone:[Va.required],
                email:[Va.required],
                password:[Va.required],
                remember_token:[Va.required],
                created_at:[Va.required],
                updated_at:[Va.required],
            },
            editData:{!! $data !!}
        },
        methods:{
            submit:function(){

                if(!validateAll(this)){
                    return
                }

                var id = App.url().param('id') || '' ;

                zhttp.post('user/save?id='+id,this.form,function (d) {
                    if(d.code == 0){
                        success('操作成功')
                        //Loader.getDialog('user/save').close()
                        go('user/index')
                    }else{

                    }
                    return false ;
                })
            }
        }
    })
</script>